#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>

using namespace std;

class Solution {
public:
    vector<int> goodDaysToRobBank(vector<int>& security, int time) {
        vector<int> ret{};
        int len = security.size();
        if (time == 0) {
            for (int idx = 0; idx < len; idx++) {
                ret.push_back(idx);
            }
            return ret;
        }

        if (len < 2 * time + 1) {
            return ret;
        }

        vector<int> curVt;
        for (int idx = time; idx < len - time; idx++) {
            bool leftFlag = false;
            bool rightFlag = false;

            curVt.clear();
            for (int left = idx; left >= idx - time; left--) {
                curVt.push_back(security[left]);
            }
            if (is_sorted(curVt.begin(), curVt.end())) {
                leftFlag = true;
            }

            curVt.clear();
            for (int right = idx; leftFlag && right <= idx + time; right++) {
                curVt.push_back(security[right]);
            }
            if (is_sorted(curVt.begin(), curVt.end())) {
                rightFlag = true;
            }

            if (leftFlag && rightFlag) {
                ret.push_back(idx);
            }          
        }


        return ret;
    }
};

int main()
{
    Solution s;
    vector<int> vt{1,2,3,4};
    vector<int> ret = s.goodDaysToRobBank(vt, 1);
    for (const auto& num : ret) {
        cout << num << " ";
    }
    cout << endl;

    // if (is_sorted(vt.begin() + 3, vt.begin() + 6)) {
    //     cout << "OK " << endl;
    // }

    // bool flag = true;
    // // 判断前半部分是否是非递增
    // for (int left = idx - time + 1; left < idx; left++) {
    //     if (security[left] > security[left - 1]) {
    //         flag = false;
    //         break;
    //     }
    // }
    // // 判断后半部分是否为非递减
    // for (int right = idx + 1; flag && right < idx + time; right++) {

    // }
    return 0;
}